//package com.yudaxian.config.mq;
//
//import lombok.Data;
//import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.amqp.rabbit.transaction.RabbitTransactionManager;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @Author: yudaxian
// * @Description: TODO
// * @DateTime: 2024/9/14 15:47
// **/
//@Configuration
//@Data
//public class RabbitConfig {
//
//    @Bean
//    public RabbitTransactionManager transactionManager(CachingConnectionFactory connectionFactory) {
//        // 事务管理器
//        return new RabbitTransactionManager(connectionFactory);
//    }
//
//    @Bean
//    public RabbitTemplate rabbitTemplate(CachingConnectionFactory connectionFactory) {
//        RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
//        // 开启事务
//        rabbitTemplate.setChannelTransacted(true);
//        return rabbitTemplate;
//    }
//}
